package cn.com.czpb.client.module.live.activity;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.os.Bundle;

import cn.com.czpb.client.R;
import cn.com.czpb.client.app.MToolBarActivity;
import cn.com.czpb.client.module.actives.HuodongFragment;
import cn.com.czpb.client.module.live.adapter.LivingPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class VideoLivingActivity extends MToolBarActivity {
    @BindView(R.id.tab_video)
    TabLayout tabLayout;
    @BindView(R.id.viewpager_video)
    ViewPager viewpager_video;
    private LivingPagerAdapter adapter;
    private List<Fragment> list;

    @Override
    public int setLayoutId() {
        return R.layout.activity_video_living;
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
        mImmersionBar.statusBarDarkFont(false).init();
    }


    //初始化碎片
    private void init(){
        list = new ArrayList<>();
        adapter = new LivingPagerAdapter(getSupportFragmentManager(), list, activity);
        viewpager_video.setAdapter(adapter);
        tabLayout.setSelectedTabIndicatorColor(getResources().getColor(R.color.color_df3031));
        for (int i = 0; i < 2; i++) {
            HuodongFragment fragment=HuodongFragment.newInstance();
            list.add(fragment);
        }
        tabLayout.setupWithViewPager(viewpager_video);
    }
}
